/* ========== 复用 HomePage 样式 ========== */
.product-detail-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #f9f9f9;
}

.header {
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 90%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 15px 0;
}

.logo img {
  width: 60px;
  height: auto;
  border-radius: 8px;
}

/* 搜索 + 返回主页 */
.search-and-back {
  display: flex;
  align-items: center;
  gap: 100px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: #f0f0f0;
  border-radius: 20px;
  padding: 8px 15px;
  flex: 1;
  min-width: 500px;
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  padding: 0 8px;
}

.search-bar button {
  background: none;
  border: none;
  cursor: pointer;
  color: #007bff;
  font-weight: bold;
}

.back-home-btn {
  padding: 8px 16px;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  font-size: 14px;
}

.back-home-btn:hover {
  background-color: #f0f0f0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background-color: #999;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.username {
  font-weight: 500;
  color: #333;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.username:hover {
  background-color: #f0f0f08a;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 145px;
  z-index: 1000;
  padding: 10px 0;
  font-size: 14px;
  margin-top: 5px;
}

.dropdown-item {
  padding: 10px 20px;
  cursor: pointer;
  transition: background-color 0.2s;
  color: #333;
}

.dropdown-item:hover {
  background-color: #f5f5f5;
}

/* ========== 主体内容 ========== */
.main-content {
  display: flex;
  gap: 30px;
  width: 90%;
  max-width: 1400px;
  margin: 20px auto;
  flex: 1;
}

.product-image-section {
  flex: 0 0 400px;
}

.image-placeholder {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  height: 400px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.image-placeholder img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.product-info-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  padding: 25px;
}

.product-title {
  font-size: 28px;
  color: #333;
  margin: 0 0 10px 0;
}

.product-subtitle {
  font-size: 16px;
  color: #666;
  margin: 0 0 15px 0;
}

.product-price {
  font-size: 24px;
  color: #d35400;
  font-weight: bold;
  margin: 0 0 20px 0;
}

.description-box,
.reviews-box {
  margin-bottom: 20px;
}

.description-box h3,
.reviews-box h3 {
  font-size: 18px;
  margin-bottom: 12px;
  color: #333;
}

.description-text {
  font-size: 14px;
  line-height: 1.6;
  color: #555;
  max-height: 120px;
  overflow-y: auto;
  padding-right: 8px;
}

.review-list {
  max-height: 150px;
  overflow-y: auto;
  padding-right: 8px;
}

.review-item {
  padding: 10px 0;
  font-size: 14px;
  line-height: 1.5;
  color: #555;
  border-bottom: 1px solid #f0f0f0;
}

.review-item:last-child {
  border-bottom: none;
}

/* ========== 复合按钮 ========== */
.dual-action-button {
  display: flex;
  width: 40%;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  margin-top: auto;
  margin-left: auto;
}

.cart-part,
.buy-part {
  flex: 1;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.cart-part {
  background: #3498db;
  color: white;
}

.cart-part:hover {
  background: #2980b9;
}

.buy-part {
  background: #2ecc71;
  color: white;
}

.buy-part:hover {
  background: #27ae60;
}

/* 加载状态 */
.loading-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 100px 20px;
  color: #666;
  text-align: center;
}

.loading-container p {
  font-size: 18px;
  margin-bottom: 20px;
}

/* 错误状态 */
.error-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 100px 20px;
  color: #666;
  text-align: center;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  max-width: 600px;
  margin: 50px auto;
}

.error-container h2 {
  font-size: 24px;
  color: #e74c3c;
  margin-bottom: 20px;
}

.error-container a {
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
  padding: 10px 20px;
  border: 1px solid #3498db;
  border-radius: 4px;
  transition: all 0.3s;
}

.error-container a:hover {
  background-color: #3498db;
  color: white;
}

/* 错误状态 */
.error-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 100px 20px;
  color: #e74c3c;
  text-align: center;
}

.error-container p {
  font-size: 18px;
  margin-bottom: 20px;
}

.error-container button {
  padding: 10px 20px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s;
}

.error-container button:hover {
  background-color: #2980b9;
}

/* 商品未找到 */
.not-found {
  text-align: center;
  padding: 50px 20px;
  color: #666;
}

.not-found a {
  color: #3498db;
  text-decoration: none;
  display: inline-block;
  margin-top: 10px;
}

/* ========== 响应式 ========== */
@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
  }

  .product-image-section {
    flex: none;
    width: 100%;
  }

  .image-placeholder {
    height: 300px;
  }

  .search-and-back {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .dual-action-button {
    flex-direction: column;
  }

  .cart-part,
  .buy-part {
    width: 100%;
  }
}